<!DOCTYPE html>
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
	<title>模板标签</title>
	<style type="text/css">
	
	ul {
		list-style: none;
		margin: 10px 0;
		border: 1px dotted #aaa;
	}

	li{
		widows: 300px;
		padding: 5px 0;
	}

    </style>
</head>
<body>
	<div class="container">
		<h1>模板标签</h1>
		<div id="box">
			
		</div>
	</div>
<script src="https://cdn.bootcss.com/decimal.js/10.2.0/decimal.min.js"></script>

<script src="https://cdn.staticfile.org/jquery/3.2.0/jquery.js"></script>
<script src="https://cdn.bootcss.com/moment.js/2.24.0/moment.min.js"></script>

<script type="text/javascript">


Date.prototype.dateFormat = function (fmt="yyyy-MM-dd HH:mm:ss") { 
     var o = { 
     	"y+": this.getFullYear(),
		"M+": this.getMonth() + 1,
		"d+": this.getDate(),
		"H+": this.getHours(),
		"m+": this.getMinutes(),
		"s+": this.getSeconds(),
		"q+" : Math.floor((this.getMonth()+3)/3), //季度 
        "S"  : this.getMilliseconds()             //毫秒 
    }; 
    if(/(y+)/.test(fmt)) {
            fmt=fmt.replace(RegExp.$1, (this.getFullYear()+"").substr(4 - RegExp.$1.length)); 
    }
     for(var k in o) {
        if(new RegExp("("+ k +")").test(fmt)){
             fmt = fmt.replace(RegExp.$1, (RegExp.$1.length==1) ? (o[k]) : (("00"+ o[k]).substr((""+ o[k]).length)));
         }
     }
    return fmt; 
}    
var date = new Date();
console.log(date)

var str = '2011-1-13 06:20:54'
var arr = str.split(/[-: ]/)
arr[1]--;
console.log(arr)

console.log(Date.parse(str))
console.log(new Date(str).dateFormat())
console.log(Date.UTC(...arr))
console.log(new Date(Date.UTC(...arr)).dateFormat() )

console.log('-----------------------\n')


var str = '2021-1-13 06:20:54'
var arr = str.split(/[-: ]/)
console.log(Date.UTC(...arr))
</script>
</body>
</html>

